package com.project.finance.verify.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.project.finance.common.mapper.TbVerifyMapper;
import com.project.finance.common.po.TbVerify;
import com.project.finance.common.vo.ResultMsg;
import com.project.finance.verify.service.VerifyService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Slf4j
@Service
public class VerifyServiceImpl implements VerifyService {
    @Autowired
    private TbVerifyMapper tbVerifyMapper;
    @Override
    public List<TbVerify> selectAll() {
        return tbVerifyMapper.selectAll();
    }

    @Override
    public ResultMsg listVerifyByPage(int pageSize, int pageNum) {
        ResultMsg resultMsg =new ResultMsg();

        PageHelper.startPage(pageNum,pageSize);

        List<TbVerify> tbVerifies = tbVerifyMapper.selectAll();
//        log.info("lijia " + tbVerifies);
        //获取结果集的分页信息
        PageInfo pageInfo =new PageInfo(tbVerifies);
        //获取总记录数
        long total = pageInfo.getTotal();
        resultMsg.setTatol(total);
        resultMsg.setData(tbVerifies);
        return resultMsg;
    }
}
